; Swimming mod. Press FORWARD when in water to "swim".
; Stear with the mouse.

; This mod doesn't work very well with missions that use boats.

004F: create_thread SwimmingMod  

...

:SwimmingMod
0001: wait 250 ms 
00D6: if 0 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false SwimmingMod 
00D6: if 0 
80E0:   NOT   player $PLAYER_CHAR driving 
004D: jump_if_false SwimmingMod5 
0054: store_player $PLAYER_CHAR position_to 1@ 2@ 3@ 
; no-swim areas (because z_ground didn't do it)
00D6: if 0 
8057:   NOT   player $PLAYER_CHAR 0 in_cube -209.0 -1450.0 0.0 -110.0 -1337.0 20.0 
004D: jump_if_false SwimmingMod 
00D6: if 1 
0021:   3@ > 0.0  ;; floating-point values 
0023:   7.0 > 3@  ;; floating-point values 
004D: jump_if_false SwimmingMod 

:SwimmingMod2
0001: wait 50 ms 
00D6: if 0 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false SwimmingMod 
0054: store_player $PLAYER_CHAR position_to 1@ 2@ 3@ 
00D6: if 0 
0023:   7.0 > 3@  ;; floating-point values 
004D: jump_if_false SwimmingMod 
00D6: if 21 
0021:   3@ > -10.0  ;; floating-point values 
80E1:   NOT   key_pressed 0 8 
004D: jump_if_false SwimmingMod4 
00D6: if 0 
00E1:   key_pressed 0 8 
004D: jump_if_false SwimmingMod2 
00D6: if 0 
8118:   NOT   actor $PLAYER_ACTOR dead 
004D: jump_if_false SwimmingMod 
04C4: create_coordinate 5@ 6@ 7@ from_actor $PLAYER_ACTOR offset 0.0 2.0 0.0 
0055: put_player $PLAYER_CHAR at 5@ 6@ 7@ 
0002: jump SwimmingMod2 

:SwimmingMod4
0055: put_player $PLAYER_CHAR at 1@ 2@ -100.0 
0002: jump SwimmingMod2 

:SwimmingMod5
03C1: 4@ = player $PLAYER_CHAR car 
00D6: if 0 
02BF:   car 4@ sunk 
004D: jump_if_false SwimmingMod 
00D6: if 3 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #rio 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #predator 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #squalo 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #speeder 
004D: jump_if_false SwimmingMod 
00D6: if 3 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #reefer 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #tropic 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #skimmer 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #coastg 
004D: jump_if_false SwimmingMod 
00D6: if 3 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #dinghy 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #marquis 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #jetmax 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #SEASPAR 
004D: jump_if_false SwimmingMod 
00D6: if 3 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #rcbandit 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #rcbaron 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #rcraider 
80DE:   NOT   player $PLAYER_CHAR driving_vehicle_type #rcgoblin 
004D: jump_if_false SwimmingMod 
0001: wait 1000 ms 
0407: create_coordinate 1@ 2@ 3@ from_car 4@ offset -3.0 0.0 0.0 
012A: put_player $PLAYER_CHAR at 1@ 2@ 3@ and_remove_from_car 
0002: jump SwimmingMod 
